package com.fansaikj.erp.domain.order;

/*
 * Copyright © 2020-2035 erupt.xyz All rights reserved.
 * Author: YuePeng (erupts@126.com)
 */

import javax.persistence.*;

import com.fansaikj.erp.domain.goods.GoodsInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.jpa.model.BaseModel;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Erupt(name = "出库单明细")
@Table(name = "erp_sales_order_detail")
@Entity
@Data
public class SalesOrderDetail extends BaseModel {

    @EruptField(
            views = @View(
                    title = "主键ID", show = false
            ),
            edit = @Edit(
                    title = "主键ID",
                    type = EditType.INPUT, show = false, notNull = true,
                    inputType = @InputType
            )
    )
    private Long id;

    @EruptField(
            views = @View(
                    title = "出库单"
            ),
            edit = @Edit(
                    title = "出库单",
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType
            )
    )
    private String salesOrderId;

    @EruptField(
            views = @View(
                    title = "采购单明细",
                    column = "id"
            ),
            edit = @Edit(
                    title = "采购单明细",
                    type = EditType.REFERENCE_TABLE,
                    referenceTableType = @ReferenceTableType(id = "id", label = "id")
            )
    )
    @ManyToOne
    @JoinColumn
    private PurchaseOrderDetail purchaseOrderDetail;

    @EruptField(
            views = @View(
                    title = "采购单号"
            ),
            edit = @Edit(
                    title = "采购单号",
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType
            )
    )
    private String purchaseOrderNo;

    @EruptField(
            views = @View(
                    title = "仓库"
            ),
            edit = @Edit(
                    title = "仓库",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String warehouse;

    @EruptField(
            views = @View(
                    title = "物资"
            ),
            edit = @Edit(
                    title = "物资",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String goodsMaterials;

    @EruptField(
            views = @View(
                    title = "物料",
                    column = "goodsName"
            ),
            edit = @Edit(
                    title = "物料",
                    type = EditType.REFERENCE_TABLE,
                    referenceTableType = @ReferenceTableType(id = "id", label = "goodsName")
            )
    )
    @ManyToOne
    private GoodsInfo goods;

    @EruptField(
            views = @View(
                    title = "材质"
            ),
            edit = @Edit(
                    title = "材质",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String material;

    @EruptField(
            views = @View(
                    title = "规格"
            ),
            edit = @Edit(
                    title = "规格",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String norms;

    @EruptField(
            views = @View(
                    title = "长度"
            ),
            edit = @Edit(
                    title = "长度",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String goodsLength;

    @EruptField(
            views = @View(
                    title = "销售数量"
            ),
            edit = @Edit(
                    title = "销售数量",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String salesQuantity;

    @EruptField(
            views = @View(
                    title = "物料单位"
            ),
            edit = @Edit(
                    title = "物料单位",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String unit;

    @EruptField(
            views = @View(
                    title = "计算方式"
            ),
            edit = @Edit(
                    title = "计算方式",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(vl = {@VL(value = "xxx", label = "xxx"), @VL(value = "yyy", label = "yyy")})
            )
    )
    private String purchaseMode;

    @EruptField(
            views = @View(
                    title = "销售重量"
            ),
            edit = @Edit(
                    title = "销售重量",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String purchaseWeight;

    @EruptField(
            views = @View(
                    title = "含税单价"
            ),
            edit = @Edit(
                    title = "含税单价",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String unitPriceWithTax;

    @EruptField(
            views = @View(
                    title = "去税单价"
            ),
            edit = @Edit(
                    title = "去税单价",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String unitPriceWithoutTax;

    @EruptField(
            views = @View(
                    title = "税率"
            ),
            edit = @Edit(
                    title = "税率",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String taxRate;

    @EruptField(
            views = @View(
                    title = "金额"
            ),
            edit = @Edit(
                    title = "金额",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String amount;

    @EruptField(
            views = @View(
                    title = "税额"
            ),
            edit = @Edit(
                    title = "税额",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String taxAmount;

    @EruptField(
            views = @View(
                    title = "价税合计"
            ),
            edit = @Edit(
                    title = "价税合计",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String amountWithTax;

    @EruptField(
            views = @View(
                    title = "产地"
            ),
            edit = @Edit(
                    title = "产地",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String originAddress;

    @EruptField(
            views = @View(
                    title = "创建人", show = false
            ),
            edit = @Edit(
                    title = "创建人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String createBy;

    @EruptField(
            views = @View(
                    title = "创建时间", show = false
            ),
            edit = @Edit(
                    title = "创建时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date createTime;

    @EruptField(
            views = @View(
                    title = "修改人", show = false
            ),
            edit = @Edit(
                    title = "修改人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String updateBy;

    @EruptField(
            views = @View(
                    title = "修改时间", show = false
            ),
            edit = @Edit(
                    title = "修改时间",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date updateTime;

    @EruptField(
            views = @View(
                    title = "备注"
            ),
            edit = @Edit(
                    title = "备注",
                    type = EditType.TEXTAREA
            )
    )
    private String remark;

    @EruptField(
            views = @View(
                    title = "删除状态(0-正常,1-已删除)", show = false
            ),
            edit = @Edit(
                    title = "删除状态(0-正常,1-已删除)",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String delFlag;

}